class MetaSingleton(type):
    _instances = {}

    def __call__(cls, *args, **kwargs):
        print("cls instances", cls._instances)
        if cls not in cls._instances:
            cls._instances[cls] = super().__call__(*args, **kwargs)
            return cls._instances[cls]


class Logger(metaclass=MetaSingleton):
    pass


logger1 = Logger()
print("logger 1 class", logger1.__class__)
print("Logger class", Logger.__class__)
print("MetaSingleton class", MetaSingleton.__class__)
logger2 = Logger()
print("logger 1", logger1)
print("logger 2", logger2)
